<?php

/**
 * 客服分组
 */
namespace app\voip\func;


use app\admin\model\Admin;
use app\voip\model\ECallGroup;

class CallFunc
{
    /**
     * @param $where
     * @param $rows
     * @param $param
     * @return \think\Paginator
     * @throws \think\exception\DbException
     */
    static function getList($where, $rows, $param)
    {
        $obj = new ECallGroup();
        return $obj->where($where)->order('id desc')->paginate($rows,false,['query'=>$param]);
    }
    /**
     * 客服组添加
     * @param $data
     * @return false|int
     */
    static public function  addInfo($data)
    {
        $obj = new ECallGroup($data);
        return $obj->allowField(true)->save();
    }
    static public function update($data)
    {
        return ECallGroup::update($data);
    }

    /**
     * @param $where
     * @return array|false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    static public function getGroupList($where)
    {
        $obj  = new ECallGroup();
        return $obj->where($where)->order('id desc')->select();
    }
    static public function getGroupInfo($where)
    {
        $obj  = new ECallGroup();
        return $obj->where($where)->find();
    }

    /**
     * @param $where
     * @return array|false|\PDOStatement|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    static public function gerGroupUserList($where)
    {
        $admin = new \app\common\model\Admin();
        return $admin->where($where)->select();
    }
}